package sg.edu.nus.iss.club.gui;
import java.awt.event.ActionEvent;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.SwingUtilities;


/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class AddMemberDialog extends OkCancelDialog {

	{
		//Set Look & Feel
		try {
			javax.swing.UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
		} catch(Exception e) {
			e.printStackTrace();
		}
	}

	private JLabel jLabel1;
	private JLabel jLabel2;
	private JTextField secondNameTextField;
	private JLabel jLabel3;
	private JTextField firstNameTextField;
	private JTextField surnameTextField;
	public ClubApplication clubApplication;

	/**
	* Auto-generated main method to display this JDialog
	*/
	public static void main(String[] args) {
		SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				JFrame frame = new JFrame();
				AddMemberDialog inst = new AddMemberDialog(frame);
				inst.setVisible(true);
			}
		});
	}
	
	public AddMemberDialog(JFrame frame) {
		super(frame);
		initGUI();
	}
	
	private void initGUI() {
		try {
			{
				getContentPane().setLayout(null);
				{
					jLabel1 = new JLabel();
					getContentPane().add(jLabel1);
					jLabel1.setText("Surname");
					jLabel1.setBounds(12, 12, 83, 16);
				}
				{
					surnameTextField = new JTextField();
					getContentPane().add(surnameTextField);
					surnameTextField.setBounds(108, 9, 193, 23);
				}
				{
					firstNameTextField = new JTextField();
					getContentPane().add(firstNameTextField);
					firstNameTextField.setBounds(107, 44, 193, 23);
				}
				{
					jLabel2 = new JLabel();
					getContentPane().add(jLabel2);
					jLabel2.setBounds(12, 47, 83, 16);
					jLabel2.setText("First name");
				}
				{
					jLabel3 = new JLabel();
					getContentPane().add(jLabel3);
					jLabel3.setText("Second name");
					jLabel3.setBounds(12, 82, 83, 16);
				}
				{
					secondNameTextField = new JTextField();
					getContentPane().add(secondNameTextField);
					secondNameTextField.setBounds(107, 79, 193, 23);
				}
				{
					okButton = new JButton();
					getContentPane().add(okButton);
					okButton.setText("OK");
					okButton.setBounds(107, 122, 46, 23);
					okButton.addActionListener(new ButtonActionListener() {
						public void actionMethod(ActionEvent e) {
							clubApplication.addMember(surnameTextField.getText(), firstNameTextField.getText(), secondNameTextField.getText());
							clubApplication.getMainWindow().refresh();
						}
					});
				}
				{
					cancelButton = new JButton();
					getContentPane().add(cancelButton);
					cancelButton.setText("Cancel");
					cancelButton.setBounds(165, 122, 69, 23);
					cancelButton.addActionListener(new CancelButtonActionListener());
				}
			}
			setSize(350, 200);
			setTitle("Add Member");
			setLocation(200, 200);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

}
